package com.jy.wms.controller;

import com.joyi.gate.comm.SessionInfo;
import com.joyi.gate.safety.vo.UserInfo;
import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.BaseSessionInfo;
import com.jy.wms.pojo.DirectSellingprovinces;
import com.jy.wms.pojo.SysHz;
import com.jy.wms.pojo.WmsProvinceRankingReport;
import com.jy.wms.service.WmsProvinceRankingReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @ClassName: WmsProvinceRankingReportController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author lqc
 * @Date Thu Mar 22 18:05:51 CST 2018
 */
@RestController
@RequestMapping("/wmsprovincerankingreport")
@Api(value = "/wmsprovincerankingreport", description = "省市报表")
public class WmsProvinceRankingReportController extends BaseController<WmsProvinceRankingReportService, WmsProvinceRankingReport> {



    @PostMapping(value = "getWmsProvinceRankingReport")
    @ApiOperation(value = "直销省市排名", response = JSONObject.class, notes = "POST查看直销省市排名")
    public @ResponseBody
    JSONObject getwmsprovincerankingreportbyid(@RequestBody DirectSellingprovinces mapp, HttpSession session) {
        JSONObject json = null;
        //获取当前操作用户的货主id
        List<SysHz> hz = (List<SysHz>) session.getAttribute(BaseSessionInfo.SessionConsignor);
        String hzid = hz.get(0).getHzid();
        //获取仓库Id
        UserInfo userinfo = (UserInfo) session.getAttribute(SessionInfo.USER_INFO);
        String ckid = userinfo.getUser().getOrgId().get(0).toString();

        json = baseService.baseselectbyprimarykey(mapp, hzid, ckid);
        return json;
    }
}
